Repository navigation
Conversation
…t to properly account for pre-calculated borns
…n to set it but inside b_sf routines uses local copy. loop still has issues
…rrangement for clarity
…cks, goal is to avoid writing to data that reasonably should be global (eg goodhel) except for a singular first run entry point
…nes and putting them in driver instead
…alculations at all
…removed now unnecessary born evaluations
…nterestingly, bitwise identicality disappears when applying cuts already at evaluation level. leaving out for now
…but statistically correct --- i think the issue is in the initial NTRY tests (also vectorised now) not properly storing vectorised running couplings
…en each amp call returns to bitwise identical results, something isn't passed to the vectorised couplings that should be
…ng calls to vectorised routines and some missed logic checks
…eparate file works perfectly, amplitude evaluation ruins bitwise consistency (still reasonable results though, just different)
…to find what differs between evaluation in driver_vec and driver; all evaluated values are identical, should be something global?
…h upstream. can't immediately see any global variables that might affect this
…back to bitwise perfection!
Recognize the model writer fixed-form coupl.f90 unit and canonical ALOHA flavour helpers while retaining checked recipes, passive record schemas and protected-symbol rejection. Restore terminal updates in physical-flavour NLO output without relaxing unknown-source fallback. Focused proof/export regressions and compiled caller/CREATE/MERGE comparisons pass.
Compile the generated objects with their model modules and native provider closure. Initialize the physical FKS row and supply its flavour index when summing explicit helicities; retain the existing numerical threshold. The acceptance regression passes on a fresh output.
The subprocess thumbnail copied to HTML/card.jpg depends on worker completion order. Exclude that derived preview while retaining byte comparisons for generated physics sources, build inputs and per-subprocess outputs. QCD, QED and W+j LOonly serial/low-memory comparisons pass.
|
Updated to
Local validation passes: 77 proof/export tests, compiled caller/CREATE/MERGE comparisons, the boosted-helicity numerical regression, QCD/QED/W+j serial-versus-low-memory generation, and seven IO test methods covering the affected FKS and short MadLoop references without golden changes. The EW W-pair standalone/native Born/link comparison also passes all 16 points with three repeats at the existing tolerances; this does not qualify the virtual optimization. New unit and IO checks are submitted. Broader acceptance, MadEvent and parallel regressions were explicitly submitted because draft PR events skip them. Results remain pending, as do the full mixed-order and polarized MC@NLO checks. The PR remains draft. AI-assisted: Codex, GPT-6.1 Sol, effort ultra |
Supply the required fifth argument to raw Born one-helicity kernels in both renormalization schemes, preserving three-argument Goldstone calls. Route native derivative callers to the explicit amplitude entry point. Add compiled ABI, derivative and parameter-restoration controls and regenerate affected standalone/native EW references. A genuine generated f2py fixed point crashes with the old calls and succeeds with this change.
Loop generation can replace a grouped model with physical flavours. Rebuild decay lookup maps from the model that generated the matrix elements and clear stale lookup caches, preserving ordinary grouped tree generation. Add physical-channel and weight regressions and strengthen the four-mode loop-induced acceptance, which passes.
|
Published
Validation includes the genuine generated Sudakov f2py reproducer (old code: SIGSEGV; fixed code: successful evaluation), compiled derivative/model-restoration controls, fresh standalone/native EW IO comparisons, and all four loop-induced MadSpin modes. The latter also checks physical PDGs and finite positive event weights. Both fixes received independent read-only review. The previously failing MC@NLO cross-section regressions now pass. The polarized local run gives 2491.27 ± 7.08 pb, satisfying its existing 2500 ± 100 pb criterion, with all twelve pole checks and the absolute-weight cancellation check passing. The mixed-order and EW standalone/native numerical comparisons are also complete at their original tolerances. Independent MINT-point batching and the real-provider UMAMI alignment are retained. Additional Born/MadLoop UMAMI providers remain separate development. Fresh unit, IO, acceptance and MadEvent runs are submitted for this revision; their results remain pending. The PR stays draft, with the validation/performance chapters reserved as requested. AI-assisted: Codex, GPT-6.1 Sol, effort ultra |
couplmod is .PHONY, so as a normal prerequisite it is always out of date: driver.o was recompiled on every launch, and matrix_*.o, mint_module.o and the objects depending on them followed (24 of 112 objects per P0 for p p > t t~ [QCD], about 50 s of each launch on 18 cores). An order-only prerequisite keeps the couplings.mod link ordered before the compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Results as of 21 November 2026. More results especially regarding physics validation may come later. All speedups use native MG7 Fortran on the same revision. Each job used one pinned AMD EPYC 9654 core. CUDA also used one NVIDIA H100 NVL. Fortran and C++ used GCC 14.2.1 with Time to generate 10,000 events · MG7
|
| Process | Fortran (s) | Scalar C++ | AVX2 | AVX-512 | H100 CUDA | Native real fraction / ideal speedup |
|---|---|---|---|---|---|---|
| Drell–Yan (e⁺e⁻) | 72.1 | 0.965× | 0.977× | 0.980× | 0.376× | 18.1% / 1.22× |
| Top pair | 93.3 | 1.036× | 1.144× | 1.149× | 0.652× | 29.4% / 1.42× |
| Drell–Yan + jet | 2,529.1 | 1.290× | 1.392× | 1.360× | 0.630× | 44.5% / 1.80× |
| Top pair + jet | 10,064.2 | 1.324× | 1.657× | 1.693× | 1.252× | 54.0% / 2.17× |
Each accelerator had three paired runs for Drell–Yan, top pair and Drell–Yan + jet (seeds 42–44), and two for top pair + jet (42–43). The latter took about 2 h 48 min in native Fortran and 1 h 39 min with AVX-512. In a separate validation sample on this revision, none of 305,294 real-amplitude requests across the 16 process/backend combinations exceeded the 10⁻⁷ allowance.
Isolated real-emission matrix elements · MG7 76ba1d6a28
Each cell gives microseconds per physical phase-space point. Parentheses give the speedup over native MG7 Fortran, paired by repetition. All implementations evaluated the same 4,096 distinct momenta per channel in double precision, summing helicities and colours. After warm-up, batches of 32,768 evaluations included input packing, amplitude evaluation, result return and checksum accumulation. CUDA includes transfers in both directions. Values are medians of three repetitions on the EPYC core or the H100 NVL. Cancellation-sensitive points were checked against a higher-precision Fortran reference.
| Physical channel | Fortran (µs) | Scalar C++ (µs) | AVX2 (µs) | AVX-512 (µs) | H100 CUDA (µs) |
|---|---|---|---|---|---|
| u ū → e⁺ e⁻ g g | 14.71 | 17.46 (0.842×) | 4.301 (3.43×) | 3.665 (4.01×) | 0.1654 (88.9×) |
| e⁺ e⁻ → b b̄ b b̄ g | 88.83 | 103.1 (0.862×) | 20.5 (4.33×) | 16.73 (5.32×) | 0.3434 (258×) |
| g g → t t̄ g g | 406 | 211.8 (1.91×) | 41.79 (9.71×) | 33.22 (12.2×) | 1.011 (401×) |
| g g → g g g g | 1,644 | 598.9 (2.75×) | 135 (12.2×) | 96.55 (17×) | 3.885 (424×) |
| g g → t t̄ g g g | 8,417 | 4,299 (1.96×) | 913 (9.23×) | 687.5 (12.3×) | 24.2 (348×) |
For u ū → e⁺ e⁻ g g, the H100 sustained 6.05 million evaluations/s. These batches measure fixed-work throughput. In event generation the accelerated evaluator receives up to four physical draws per call for scalar C++ and AVX2, and eight for AVX-512 and CUDA. The full workflow also spends time outside real-emission evaluation.
Pointwise agreement · MG7 37bd4e0963
We compared accelerated and native MG7 Fortran amplitudes at identical momenta, flavours and couplings during grid training, envelope construction and event generation. Each sampled matrix-element request counts once per column if its total or any squared coupling-order component satisfies |accelerated − native| > 10⁻³⁰ + t × |native|. An asterisk marks an affected process/backend. These are counts of evaluations, including integration draws. Several evaluations can contribute to one accepted event.
| Process and backend with an exceedance | Requests checked | >10⁻⁷ | >10⁻⁶ | >10⁻⁵ | >10⁻⁴ | >10⁻³ |
|---|---|---|---|---|---|---|
| Drell–Yan + jet, AVX-512* | 85,505 | 10 | 0 | 0 | 0 | 0 |
| Top pair + jet, Scalar C++* | 97,627 | 1 | 0 | 0 | 0 | 0 |
| Top pair + jet, AVX2* | 97,627 | 1 | 0 | 0 | 0 | 0 |
| All completed CPU comparisons | 686,632 | 12 | 0 | 0 | 0 | 0 |
Across four processes, three CPU backends and three seeds (42, 7301, 7303), 12 of 686,632 requests exceeded 10⁻⁷. The largest difference was 6.39 × 10⁻⁷ for Drell–Yan + jet on AVX-512. The H100 pointwise sample on this revision is pending.
Integrated signed cross sections · MG7 37bd4e0963
Native Fortran and scalar C++ each generated 10,000 unshowered events per independent seed on one EPYC 9654 core, with the same 13 TeV settings and classic Ninja. Each entry gives the mean signed cross section in picobarns. Quoted uncertainties propagate the generator’s independent integration errors in quadrature to the mean.
| Process | Seeds per implementation | MG7 Fortran (pb) | MG7 scalar C++ (pb) |
|---|---|---|---|
| Drell–Yan (e⁺e⁻) | 3 | 845.69 ± 2.14 | 844.47 ± 2.37 |
| Top pair | 3 | 658.45 ± 1.90 | 658.23 ± 1.80 |
| Drell–Yan + jet | 1 | 160.70 ± 0.83 | 161.63 ± 0.96 |
The central values differ by less than one combined integration uncertainty in all three channels. The available seeds leave the statistical equivalence of the event distributions unresolved.
AI-assisted: Codex, GPT-6.2 Astra, effort ultra
oliviermattelaer
left a comment
There was a problem hiding this comment.
Review of the PR's own changes since f8387c674c: the main merges (mine, then Daniele's 995cb75450 and caf19acb5e), Daniele's 12 commits of 2026-11-21 and 438062c9c3, at head 438062c9c3. Six inline comments: three to fix before merging, three optional.
Checked and fine: the UMAMI 1.5 key layout from the merge, the checkres2 bound, the zeroed sparse JAMP, sborn_amp in the frame wrapper, the Sudakov saved-amplitude argument, the MadSpin model resync, and the private :: vector extents. test_w_nlo_gen_qcd passes on this head.
CI on this head: acceptancetest_mg7_bundle_2 is the real failure (first inline comment). These reds are not from this PR:
acceptancetest_core_1,acceptancetest_mg7_uncovered,check_xsec_processes (ttx2j): the Delphes/HEPtools caches were not restored on the PR branch.- The pyAmpliCol release jobs: the prepared-bundle check fails here but passes on main
c2e5a61db6. The PR does not touch pyamplicol, so merging main again should fix it.
| # bloating a tree library, loop-only helpers use functions such as COND | ||
| # and reglog which are intentionally absent from MadMatrix device code. | ||
| # Retain the transitive parameter closure of the selected couplings. | ||
| if wanted_couplings: |
There was a problem hiding this comment.
Important: MadMatrix standalone output with running custom-propagator parameters no longer compiles. Parameters.h assigns out.HP_mdl_running_complex = mdl_running_complex;, but the parameter's own assignment is written commented out.
Cause: this closure filter rewrites self.params_dep, and it drops mdl_sqrt__aS/G when no selected coupling uses G (e.g. b b~ > h > ta+ ta-). super_generate_parameters_class_files comments out every parameter until it reaches G (foundG), so all the running parameters after it are commented out as well.
Effect: this is the acceptancetest_mg7_bundle_2 failure on this head. test_madmatrix_running_helas_complex_mass and test_madmatrix_running_helas_pole_precision fail with use of undeclared identifier 'mdl_running_complex' (Parameters.h:256-257). I reproduced it on macOS at 438062c9c3; both tests pass on main c2e5a61db6.
Suggested fix: drop this block. Main's used_dependent_parameters() already limits the per-event code to what coups_dep needs, without touching params_dep. Otherwise, always keep the parameters up to and including G.
There was a problem hiding this comment.
Fixed in def7855: the filter now always keeps the parameters up to and including G. The three test_madmatrix_running_helas_* acceptance tests pass, and the mg7-exporter p p > t t~ [QCD] still builds and gives 627.6 ± 2.9 pb (MC@NLO, simd_128).
| # the checked MODEL recipe compiles it with -ffixed-form. Other | ||
| # .f90 units still require a free-form parser and stay outside | ||
| # this proof. | ||
| fixed_module = (path == export / 'Source/MODEL/coupl.f90' and |
There was a problem hiding this comment.
Important: Standalone loop outputs from this branch still keep the dense UPDATE_WL calls, so they lose #508's 11-20% virtual speed-up that main has.
Cause: this exception accepts coupl.f90 only at Source/MODEL/coupl.f90. A standalone proof scans the whole of SubProcesses, where export_v4 also links SubProcesses/coupl.f90, and that link is refused with Unsupported compilation language. MC@NLO loop directories are not affected: their scope is only the V* directory, MODEL and DHELAS.
Reproduction: import model loop_sm; generate u d~ > e+ ve [virt=QCD]; output standalone X. On 438062c9c3 the log says DP terminal proof refused for SubProcesses/P0_udx_epve: Unsupported compilation language, and coef_construction_1.f has 0 DP_TERMINAL_WL calls; main has 1.
Suggested fix: also accept a coupl.f90 that resolves to Source/MODEL/coupl.f90, without adding it as a second unit. Alternatively, stop linking the source into SubProcesses.
There was a problem hiding this comment.
Fixed in a9bd395: the proof skips a coupl.f90 link only when it resolves to Source/MODEL/coupl.f90, which is in scope and checked in full. A link to another file, or a copy, is still refused (new test test_standalone_link_to_the_model_module_is_the_model_unit). u d~ > e+ ve [virt=QCD] standalone now gets 1 DP_TERMINAL_WL call, as on main.
| self.skipTest('gfortran required') | ||
| root = Path(MG5DIR)/'Template/NLO/SubProcesses' | ||
| driver = (root/'driver_mintMC.f').read_text() | ||
| first = driver.index('call reset_weight_lines_vec(nexternal)') |
There was a problem hiding this comment.
Important: Several unit tests added by this PR are broken on every platform, and no CI job runs them, so they give false coverage. On 438062c9c3:
TestVirtualFoldCache: looks forcall reset_weight_lines_vec(nexternal)indriver_mintMC.f, which the branch removed (ValueError: substring not found). Its probe also usesvs_ratio/vs_vcomp, which no longer exist.TestNLOCouplingTimer,TestNLOAlphasWrapper: link withouttiming.f, so_timing_enter_is undefined.TestNLORealDiagramRouting: needs a missingmc_batch_trace.mod.TestHostBlasBuild: fails on' -lblas' != '-lblas'.
None of these classes appears in .github/workflows/*.yml, and the *_uncovered jobs list their tests by name. Suggested fix: update the tests to the current sources and add the classes to one of those lists.
There was a problem hiding this comment.
Fixed in 5737759:
TestVirtualFoldCachefollows the currentbornsoftvirtualblock. I checked it fails if the fold restore is broken.TestNLOCouplingTimernow expects 8 clock reads for the separate path and 0 for the fused one.- The other tests needed stubs, the trace module, and the BLAS flag blank.
- The bridge-rebuild contract gives each loaded copy its own install name on macOS.
The five classes are now in the native-scheduling lists of unittest.yml, and pass with -t0 (no skips).
| '\t$(MAKE) -f nlo_real.mk clean', | ||
| '\trm -f .nlo_real_*.stamp nlo_real_backend.inc', | ||
| ] | ||
| with open(pjoin(process_path, 'nlo_real_offload.mk'), 'w') as stream: |
There was a problem hiding this comment.
Nit (optional): Outputs made with --me_exporter=mg7 never get #508's DP terminal updaters: every V* loop directory keeps the dense calls. The proof accepts only verbatim templates for build inputs and C/C++ sources. This mode generates P0_*/nlo_real.mk, nlo_real_offload.mk, SubProcesses/madmatrix.mk and the PMM_* MadMatrix sources, which gives 18 non-template recipes, 12 preprocessed units and 25 links outside the scanned tree.
For p p > t t~ [QCD] the default exporter gets 20/8/8 DP calls, as on main; with --me_exporter=mg7 it gets 0/0/0.
Either document that this mode stays dense, or extend the proof to treat the MadMatrix real-emission tree as a separately linked library: recipes rendered from their templates, sources scanned for the loop-storage names. That is a decision about #508's trust model.
| end subroutine compute_integrand | ||
|
|
||
|
|
||
| subroutine compute_integrand_vec(fun) |
There was a problem hiding this comment.
Nit (optional): Fixed-order runs through this vector path report nearly all their time under Weights_and_bookkeeping, with Born, Real and Virtual at 0. For example, p p > t t~ [QCD] with --me_exporter=mg7 gives Weights 1.26 s of a 1.45 s total.
Cause: compute_integrand_vec never calls timing_begin_point/timing_end_point, so timing_sampled stays false and no category is entered. The scalar compute_integrand does sample.
Suggested fix: open and close a sampled point around each fun() call (or each vector page) here, as compute_integrand does.
| call = call.replace(before, after, 1) | ||
| res.append(call) | ||
| for lamp in ldiag.get_loop_amplitudes(): | ||
| cut_seed = self._open_loop_flavor_seed(lamp, True) |
There was a problem hiding this comment.
Nit (optional): With flavour-grouped virtuals, a loop amplitude with a cut flavour seed builds its loop-wavefunction chain twice. The shared chain is written first, then rebuilt here after LOOP_FLAVOR(cut) is set, and the rebuild overwrites WL(...,last) before CREATE_LOOP_COEFS reads it.
Effect: when the chain feeds only this amplitude, the first copy is dead work. The repeated terminal UPDATE_WL also makes #508's rewriter give up on the whole directory (Duplicate or labeled DP terminal producer). Example: p p > w+ QED^2=2 QCD^2=0 [QCD] with _experimental_nlo_flavor_grouping, in V0_QxQ_wp.
Suggested fix: skip the shared emission for loop wavefunctions that only this amplitude's rebuilt chain reaches, or write the chain once, after the seed. This path is experimental today.
The closure filter of prepare_couplings dropped mdl_sqrt__aS and G when no selected coupling uses G (b b~ > h > ta+ ta-). super_generate_parameters_class_files writes the parameters up to G as comments and only writes the later ones for real once it reaches G, so every running parameter was commented out while the HP_ propagator buffers still read it: the running-HELAS outputs did not compile (acceptancetest_mg7_bundle_2, mdl_running_complex undeclared). The filter now always keeps the parameters up to and including G. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Standalone exports link the couplings module as SubProcesses/coupl.f90, which the proof refused as a free-form unit, so standalone loop outputs kept the dense UPDATE_WL calls (u d~ > e+ ve [virt=QCD]: 0 DP terminal calls, main 1). The link is skipped only when it resolves to Source/MODEL/coupl.f90, which is in scope and checked in full; a link to another file or a copy is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These tests failed on every platform and no CI job ran them: - TestVirtualFoldCache: the probe declares the virt_surrogate state the grid training now reads; the fold test follows the current bornsoftvirtual block (first_virtual_evaluation, binothlha_frame, Born-spreading phases) with per-lane saved values; the storage test keeps the lifecycle driver.f90 still has. - TestNLOCouplingTimer, TestNLOAlphasWrapper: stub timing_enter/leave; only set_alphaS_vec_from_scalar still reads the clock (8 reads, the fused path none). - TestNLORealDiagramRouting: compile mc_batch_trace.f90 and stub mg7_nlo_real_is_fortran, which the wrapper now uses. - TestHostBlasBuild: make joins the BLAS flags with a blank. - The bridge-rebuild contract gives each loaded copy its own install name on macOS (dyld reuses an image with the same install name). The first five classes join the native-scheduling unit test lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fks_buffered.f wrapped every buffered routine (Born, real emission, counterterms, n-body integrated terms, multichannel factor, OLP call) in unconditional cpu_time pairs. Each is a getrusage system call per point and per FKS configuration (17% of the samples of a p p > e+ e- j [QCD] fixed-order channel, 6x the system time of main), and they fed tBorn, tReal, ... which the sampled timing report no longer prints. They now enter the sampled categories like fks_singular.f does, after each routine's early returns. compute_integrand_vec samples one vector page as compute_integrand samples one point, so batched fixed-order runs report categories too. Results are unchanged (same channel results bit for bit); one channel goes from 3.5-4.1 s to 3.2-3.4 s single-core (main 3.0 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: - export_fks.py: keep born_color_links_in_born = False (the buffered FKS callers pass explicit saved-amplitude arrays, which the combined-colour Born template cannot provide yet) and take main's sudakov_density_kernel = False. - ewsudakov_wrapper.inc: keep the saved-amplitude argument of sborn_onehel; main removed AMP_BORN_SUMHEL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uild tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sigint forced calculatedBorn=.false. before each of its 27 Born calls, so every counterterm Born was recomputed from scratch even at the same momenta (Z+j: about twice main's fresh Born evaluations). Call refresh_born_cache instead: when born.f records its couplings and the cache belongs to the current FKS configuration it sets check_born_amps, so SBORN reuses its amplitudes only for identical momenta and couplings, rescaling them when only G changed; otherwise it discards them as before. Z+j fixed order (4000x2 + 20000x2 points): CPU 44.6 -> 39.9 s, channel results agree to 1e-5 (G rescaling rounding through grid adaptation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without the homogeneous_G certificate the real-emission and Born helicity masks are keyed on the exact value of G, so with a dynamic scale every real call relearned its mask and summed all helicities (d d~ > e+ e- g g: 64 instead of 16). Three things broke the certificate: - ALOHA_OBJECT now uses MODEL_OBJECT and contains the flavour-coupling accessors; explicit_helas_dependencies rejected both. Accept the USE when MODEL_OBJECT only defines types, and skip the module procedures: their names are not certified, so a helper calling one stays rejected. - helicity_coupling_degrees used ast.Num, removed in Python 3.14, so every coupling came out of unknown degree (main is affected too). - SBORN's gscale bookkeeping (rg=g/saved_g, saved_g=g) counted as a direct read of G, keeping G in the exact key. Z+j fixed order: CPU 39.9 -> 26.2 s with bit-identical results. On nic6 (Python 3.13) main still certified, which is most of why this branch looked 2.4x slower than main there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The native MC cohort restores every lane's surrogate point before it commits it, and a draw that never reached the virtual carries the default vs_nfeat of 4. vs_solve, vs_value and vs_write_grids read that per-point global, so when the last committed lane of an iteration was such a draw the fit solved only 4 of the 24 normal equations, kept the stale coefficients 5..24 from the previous fit, and the next iteration applied that mixture. The residual V-A then blew up (DY+j at vector_size 16: virtual -1.9 instead of 0 +- 0.03, chi2 68). The result stays exact, but MINT0 needs 3 more doubled iterations, and the channel drops the surrogate for the rest of the run. Keep the feature count of each channel's normal equations and coefficients in vs_fit_nfeat, set by the first accumulated point (a mismatch stops) or by the saved grid, and use it to solve, evaluate and save the fit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e provider The fixed-order driver evaluates the Born through sborn_amp_frame, whose legacy implementation keeps one saved-amplitude slot (CALCULATEDBORN). sigint alternates the Born, collinear, event and no-radiation kinematics, so the slot thrashes and most calls recompute every helicity amplitude; the colour links then sum per link over those saved amplitudes. Main evaluates the same Born through the native provider, whose multi-slot cache also accumulates the helicity-summed colour density. In outputs with the native Born provider: - sborn_amp_frame calls sborn_frame and copies the provider buffers (amp2, jamp2, amp_split, amp_split_cnt, ans_cnt). It returns no per-helicity amplitudes. - sborn_sf_store takes each colour or charge link from sborn_sf_frame, a contraction of the provider's colour density. - PickHelicityMC reads the provider's sborn_hel weights from COMMON/C_BORN_HEL_SPLIT/, as on main. The export stops if the sampler no longer has the expected call, or if its WGT_HEL shape differs from the common block declared by sborn_hel. - The callers that need the amplitudes themselves (the buffered EW Sudakov and the check_sudakov programs) fill them with the new sborn_amp_saved_frame. Fixed order, same grids and seeds, old against new path: - p p > e+ e- j [QCD]: 12 channels agree to 3e-14. - p p > t t~ [QCD]: 3 channels agree to 3e-15. - u u~ > e+ e- [QED] (charge links): bit-identical. - p p > t t~ [QCD] --ewsudakov: 11 channels agree to 4e-15, histograms byte-identical. MC@NLO events from the same grids and seeds: 94000 records (e+ e- j and t t~) bit-identical. Z+j fixed order: 19% less CPU on the Mac, and 103 s to 78 s wall on a cluster node (main 72 s). MC@NLO timing is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A native MC@NLO cohort parks every lane at its real-emission request and runs the other lanes before it resumes. The Born provider kept an LRU of 4 points per provider, so at vector_size 16 the lanes evicted each other's Born and it was recomputed: Born CPU +60% per point, which cancelled most of the batched real's gain. - The provider LRU now has 4 slots per lane. The MC driver sets the lane count (born_set_cache_lanes); the entries per provider are capped at 64 MiB and never fall below 4. Width 1 and fixed order keep 4. - The batched real wave runs outside every sampled draw, so the timing report showed Real_matrix_elements 0 and left that time out of every category. Each sampled draw in a wave is now charged its share of the wave under Real_matrix_elements. Z+j MC@NLO on a cluster node (seed 4242, 32 jobs): - Width 1: events byte-identical to before (and to main). - Width 16, avx512y real: MINT0 CPU 391 -> 348 s, MINT1 687 -> 625 s, Born 107 -> 72 s in MINT0; wall 88 -> 79 s (main 71 s). The first MINT0 iteration agrees with the old cache to 7e-16 (cache hits rescale saved amplitudes instead of recomputing them); grid adaptation then amplifies that rounding, so later results and events are not bit-identical. Results are reproducible run to run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At vector_size 16 the native MC cohort parks and resumes each lane once per real-emission wave and allocates fresh lanes for every cohort. Two paths reallocated on each of these switches: - park_native_shower took its state intent(out), which freed every allocatable component, and the assignments then reallocated them. It now assigns into the lane's existing buffers (same-shaped arrays keep their storage) and frees only what the active state no longer has. - Every fresh lane started a weight-line store with one contribution and add_wgt regrew it by doubling; the store was freed with the lane at the end of the cohort. Released lanes now hand their stores to a pool, and a fresh lane adopts one at its grown capacity, reset to a fresh store's contents (no contributions, no calibration or legacy arrays) and re-reserved in the memory budget. The legacy width-one path does not use either routine. Z+j MC@NLO on a cluster node (seed 4242, 32 jobs), against the previous commit: events byte-identical at width 1 and at width 16. Width 16, avx512y real: MINT0 CPU 341 -> 309 s, MINT1 596 -> 565 s (main 292 and 592 s). The wall time is unchanged within the node's noise; the grid setup's slowest channels set it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At vector_size 16 every real-emission wave parks and resumes each lane. Two blocks were copied both ways on every switch: - the per-point shower scales (shower_scale_*, showerscaleS/H, emsca_*, event_colour_H), and - the lane's real-emission cache (16 entries). Both now trade storage with the active state by move_alloc. The scale arrays are only written while a point evaluates; the process arrays, which update_fks_dir rewrites before the shower is restored, are still copied. A fresh point, which used to see the last parked point's values, gets them by one copy (materialize_native_shower), as do readers after the cohort. The active real cache a fresh point finds is only read after its first shared real point resets it (epoch check). Z+j MC@NLO, against the previous commit: - nic6 (seed 4242, 32 jobs): events byte-identical at width 1 and 16. - Mac (simd_128, width 16, old and new run side by side): MINT0 CPU 5.3% lower in all 12 paired channel runs, identical results; full run MINT0 503 -> 476 s, MINT1 880 -> 819 s. The table sync and per-sector FKS setup redone on every activation (about 5% of the run) are unchanged: they write the same tables, so neither can be skipped alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MC@NLO timing on nic6: main vs this PR (head 2e42d1c)Setup:
p p > t t~ j [QCD], 2000 events
p p > e+ e- j [QCD], 5000 events
Changes in the last three pushes (8e772ba, 5333c5e, 2e42d1c)
Known issueOn many cores, the first compile of a |
…arallel
Every P* directory of a --me_exporter=mg7 NLO output links the same common
library from src/. compile_dir runs the P* directories in parallel, and each
one rebuilt that library, so on many cores one could link
HelRecyclingScratch.o while another was still writing it ("file not
recognized"). The run interface now builds it once through one real-emission
directory (nlo_real_commonlib -> nlo_real.mk commonlib) and compiles the P*
directories with MADMATRIX_COMMONLIB_EXTERNAL=1, as the LO SubProcesses
makefile already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This PR adds batched MadMatrix evaluation of NLO real-emission matrix elements to the native Fortran workflow, extends standalone FKS reference tools, and integrates the required physical-flavour and multi-event interfaces. Phase-space generation, Born and virtual amplitudes, subtraction, matching and event orchestration retain their native Fortran implementation.
Draft: validation and performance summaries are being prepared. Numerical qualification and CI validation remain in progress before this PR is marked ready for review.
Standalone FKS
Extends
output standalone_fortran --fks [--limits]with deterministic multi-point evaluation of the production BornB, spin-correlatedBORNTILDEand colour/charge-linkedB_ijbuilding blocks. It reports momenta and results in a parseable format independently of adaptive integration.The optional
--limitsoutput retains the production real/counterterm chain for the existing soft/collinear checks. This provides a reference for subsequent interfaces; it is not a complete standalone real-plus-virtual NLO provider. The integration preserves Olivier Mattelaer's original standalone FKS contribution and extends its reference machinery.Parton grouping and physical flavours
NLO generation automatically imports physical, ungrouped flavours, including when the public LO grouping option is enabled. LO grouping remains available; experimental NLO grouping is confined to a developer setting.
The underlying NLO/FKS implementation carries explicit physical identities and separate Born, real and virtual flavour mappings through generated amplitudes, PDFs, normalization, weight records and flavour-aware caches. This infrastructure preserves the physical channel selected by the Fortran calculation without requiring providers to share one flavour index.
Multi-event interface
Integrates Zenny Wettersten's multi-event NLO work while preserving its original contribution history, and adapts it to current MG7. The underlying interface is described by R. Frederix, S. Roiser, R. Schöfbeck, Z. Wettersten and M. Zaro in A multi-event interface for next-to-leading order calculations in MadGraph5_aMC@NLO.
Native MINT draws own their sampling, fold/history cursors, kinematics, model state and contributions. Cooperative continuations pause at full-real requests and resume with results returned to the original owners. Width-one execution uses the same staged physics synchronously. Grid training and integration commit completed draws in issue order; generation retains finalized accepted-event records in stream-specific queues and accounts for terminal surplus.
The native Fortran control flow remains serial. The branch incorporates successive main updates while retaining current native Born/history ownership, instance-owned model state, separated MadMatrix backends and explicit standalone/fixed-order interfaces.
Real offloading with batches
output <directory> --me_exporter=mg7generates MadMatrix libraries alongside the retained Fortran real matrix elements. Compatible pending requests from independent MINT draws are packed and sent through a checked Fortran–C++ bridge to UMAMI 1.5 libraries, using scalar C++, CPU SIMD or supported CUDA/HIP implementations. Results are scattered back to their owning requests before native FKS assembly resumes.The contract retains physical flavours, per-point strong couplings, polarization frames, helicity/colour sums and signed squared-order components. The bridge requests unit-coupling blocks and restores physical coupling powers; the Fortran caller projects local orders into the global FKS layout and applies subtraction factors. Partial batches are supported; backend padding is not counted as independent physics work.
flowchart LR subgraph Before["Before"] direction TB B1["mint / gen"] --> B2["sigintF"] B2 --> B3["Fortran real matrix element"] end subgraph After["After"] direction TB A1["mint / generate_mc_trials"] --> A2["evaluate_native_cohort"] A2 --> A3["sigintF_advance"] A3 -->|Real request| A4["mc_dispatch_provider_wave"] A4 --> A5["Fortran-C++ bridge / UMAMI / MadMatrix"] A5 -->|Results to owners| A3 A3 -->|Completed point| A6["MINT accumulation / accepted-event queue"] end Before ~~~ AfterThe batched path serves grid training, integration and event generation in
madevent_mintMC. Fixed-order execution retains its separate native interface. The generated native bridge selects Linux/ELF or Darwin link conventions, including platform-specific library names and runtime paths.Defaults remain
nlo_real_backend=fortranandvector_size=1. Select a generated backend andvector_size>1to enable independent-draw batches;nlo_gen_vector_sizeseparately caps generation capacity. Live state and accepted records are memory-bounded, and restart binds completed grids to their source, cards, backend and capacities.Required native diagram weights and unsupported matrix-element capabilities retain Fortran evaluation. GPU support remains capability-dependent, including the single-amplitude-order restriction; HIP runtime coverage and numerical exclusions will be stated in validation. The native real-provider guide documents ownership traces, decision replay and the independent Fortran oracle.
Validation
To be completed as soon as possible.
Performance
To be completed as soon as possible.
AI-assisted development: Claude Opus 5.5 (high effort); GPT-Sol 5.8, 6.0, 6.1 and 6.2 (xthink, ultra); GPT Astra 6.0 and 6.2 (ultra).